﻿Imports System.Data.SqlClient
Imports UTNComputers.clsTipo_Os
Imports UTNComputers.clsEmpleado
Imports UTNComputers.clsCliente
Imports UTNComputers.clsEstado_Os
Imports UTNComputers.clsOrden_Servicio_Detalle

Public Class clsOrden_Servicio

    Private mOs_Id As Int32
    Private mTipo_Os As Int32
    Private mOs_Fecha_Inicio As Date
    Private mOs_Fecha_Fin As Date
    Private mTec_Id As Int32
    Private mCli_Id As Int32
    Private mOs_Estado As Int32
    Private mOs_IMporte As Decimal
    Private mTipo As clsTipo_Os
    Private mEmpleado As clsEmpleado
    Private mCliente As clsCliente
    Private mEstado As clsEstado_Os
    Private mDetalle As List(Of clsOrden_Servicio_Detalle)
    Private mCod_Suc As Int32


    '/////////////////////////////////////////////////////////
    '/ Propiedades
    '/////////////////////////////////////////////////////////


    Public Property Os_Id() As Int32
        Get
            Return mOs_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mOs_Id = value
            Else
                Throw New Exception("No se puede utilizar el código de orden de servicio. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property

    Public Property Tipo_Os() As Int32
        Get
            Return mTipo_Os
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mTipo_Os = value
            Else
                Throw New Exception("No se puede utilizar el tipo de orden. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Os_Fecha_Inicio() As Date
        Get
            Return mOs_Fecha_Inicio
        End Get
        Set(ByVal value As Date)
            mOs_Fecha_Inicio = value
        End Set
    End Property

    Public Property Os_Fecha_Fin() As Date
        Get
            Return mOs_Fecha_Fin
        End Get
        Set(ByVal value As Date)
            mOs_Fecha_Fin = value
        End Set
    End Property
    Public Property Tec_Id() As Int32
        Get
            Return mTec_Id
        End Get
        Set(ByVal value As Int32)
            If value >= 0 Then
                mTec_Id = value
            Else
                Throw New Exception("Tecnico incorrecto.")
            End If
        End Set
    End Property

    Public Property Cli_Id() As Int32
        Get
            Return mCli_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mCli_Id = value
            Else
                Throw New Exception("No se puede utilizar el código del cliente. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Os_Estado() As Int32
        Get
            Return mOs_Estado
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mOs_Estado = value
            Else
                Throw New Exception("No se puede utilizar el estado de la orden de servicio.")
            End If
        End Set
    End Property

    Public Property Tipo() As clsTipo_Os
        Get
            Return mTipo
        End Get
        Set(ByVal value As clsTipo_Os)
            mTipo = value
        End Set
    End Property
    Public Property Empleado() As clsEmpleado
        Get
            Return mEmpleado
        End Get
        Set(ByVal value As clsEmpleado)
            mEmpleado = value
        End Set
    End Property
    Public Property Cliente() As clsCliente
        Get
            Return mCliente
        End Get
        Set(ByVal value As clsCliente)
            mCliente = value
        End Set
    End Property
    Public Property Estado() As clsEstado_Os
        Get
            Return mEstado
        End Get
        Set(ByVal value As clsEstado_Os)
            mEstado = value
        End Set
    End Property
    Public Property Os_Importe() As Decimal
        Get
            Return mOs_IMporte
        End Get
        Set(ByVal value As Decimal)
            If (value >= 0) Then
                mOs_IMporte = value
            Else
                Throw New Exception("No se puede utilizar el importe de la orden de servicio. El importe debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Detalle() As List(Of clsOrden_Servicio_Detalle)
        Get
            Return mDetalle
        End Get
        Set(ByVal value As List(Of clsOrden_Servicio_Detalle))
            mDetalle = value
        End Set
    End Property
    Public Property Cod_Suc() As Int32
        Get
            Return mCod_Suc
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mCod_Suc = value
            Else
                Throw New Exception("Codigo de sucursal incorrecto")
            End If
        End Set
    End Property
    '/////////////////////////////////////////////////////////
    '/ Métodos de la Clase
    '/////////////////////////////////////////////////////////

    '---------------------------------------------------------------------
    ' Constructor de la Clase
    '---------------------------------------------------------------------
    Public Sub New()

        MyBase.New()

    End Sub
    '---------------------------------------------------------------------
    ' Destructor de la Clase
    '---------------------------------------------------------------------
    Public Sub Dispose()

        MyBase.Finalize()

    End Sub

End Class
